Skip to content

DOC improve the UG documentation of the classification report #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 7, 2021

Conversation

DavidRosen
Copy link
Contributor

@DavidRosen DavidRosen commented Oct 11, 2021

…mbalanced` output contains

Update metrics.rst -- say what bottom row of classification_report_imbalanced output contains

...and especially point out that the Weighted Average Recall as displayed by classification_report_imbalanced is also better known as the Accuracy! Maybe this should also be a change in the API docs for classification_report_imbalanced but the "Edit" link there didn't work. BTW the Accuracy and Wtd Avg Recall are also the same as the Micro Avg Recall but I'm not sure if that's important so I didn't mention it in the update.

Proof that Weighted Average Recall == Accuracy:

Let Ntot be total number of instances. Let iclass be the class index.
Note that recall(iclass) * support(iclass) = number of instances in iclass classified correctly.

Wtd Avg Recall = sum over all iclass (recall(iclass) * proportion(iclass) ) {by definition of Wtd Avg Recall}
= sum over all iclass (recall(iclass) * support(iclass) / Ntot )
= sum over all iclass (recall(iclass) * support(iclass) ) / Ntot
= sum over all iclass (number of instances in iclass classified correctly) / Ntot {from Note above}
= total number of instances classified correctly / Ntot
= Accuracy {by definition of Accuracy)

Reference Issue

What does this implement/fix? Explain your changes.

Any other comments?

…mbalanced` output contains

Especially point out that the Weighted Average Recall that `classification_report_imbalanced` displays is also better known as the Accuracy!  Maybe this should also be a change in the API docs for  `classification_report_imbalanced`  but the "Edit" link there didn't work.
@DavidRosen
Copy link
Contributor Author

DavidRosen commented Oct 11, 2021

Hi, the full title for this proposed change got truncated (sorry if I made it too long). It was supposed to be:
"Update metrics.rst -- say what bottom row of classification_report_imbalanced output contains"

@glemaitre glemaitre changed the title Update metrics.rst -- say what bottom row of `classification_report_i… DOC improve the UG documentation of the classification report Dec 7, 2021
@glemaitre glemaitre self-assigned this Dec 7, 2021
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DavidRosen. LGTM. I merge master into your branch and make minor changes.
I will merge once the CIs are happy.

@codecov
Copy link

codecov bot commented Dec 7, 2021

Codecov Report

Merging #868 (cb01a77) into master (79394a3) will decrease coverage by 2.82%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #868      +/-   ##
==========================================
- Coverage   97.18%   94.36%   -2.83%     
==========================================
  Files          96       96              
  Lines        6253     6155      -98     
  Branches      712      584     -128     
==========================================
- Hits         6077     5808     -269     
- Misses        104      283     +179     
+ Partials       72       64       -8     
Impacted Files Coverage Δ
imblearn/keras/tests/test_generator.py 8.62% <0.00%> (-91.38%) ⬇️
imblearn/tests/test_docstring_parameters.py 29.41% <0.00%> (-56.92%) ⬇️
imblearn/keras/_generator.py 51.31% <0.00%> (-40.79%) ⬇️
imblearn/tensorflow/_generator.py 84.37% <0.00%> (-15.63%) ⬇️
imblearn/base.py 94.52% <0.00%> (-4.13%) ⬇️
imblearn/tensorflow/tests/test_generator.py 64.44% <0.00%> (-1.15%) ⬇️
imblearn/pipeline.py 93.47% <0.00%> (-1.09%) ⬇️
imblearn/utils/tests/test_docstring.py 83.33% <0.00%> (-0.88%) ⬇️
imblearn/ensemble/_forest.py 91.61% <0.00%> (-0.70%) ⬇️
imblearn/datasets/tests/test_zenodo.py 91.42% <0.00%> (-0.47%) ⬇️
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79394a3...cb01a77. Read the comment docs.

@glemaitre glemaitre merged commit dde338b into scikit-learn-contrib:master Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants